Skip to content

fix: harden cloud run runtime guard#200

Merged
Pigbibi merged 1 commit into
mainfrom
codex/runtime-guard-hardening-20260704
Jul 3, 2026
Merged

fix: harden cloud run runtime guard#200
Pigbibi merged 1 commit into
mainfrom
codex/runtime-guard-hardening-20260704

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • scope Cloud Run log queries by region
  • ignore monitor-dispatch capacity-only 429 noise by default while keeping strategy failures strict

Test Plan

  • python3 -m pytest tests/test_cloud_run_runtime_guard.py
  • python3 -m ruff check scripts/cloud_run_runtime_guard.py tests/test_cloud_run_runtime_guard.py
  • git diff --check
  • live runtime guard check

Co-Authored-By: Codex <noreply@openai.com>
@Pigbibi Pigbibi merged commit cba8cf4 into main Jul 3, 2026
2 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eb1314d42f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

f'AND resource.labels.service_name="{service}" '
f'AND timestamp >= "{service_since_text}"'
)
log_filter = _cloud_run_log_filter(service, service_since_text, _region_for_service(service))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Skip disabled target regions before scoping log reads

When CLOUD_RUN_SERVICE_TARGETS_JSON contains a disabled target for the same service before an enabled target (or before a service also supplied via RUNTIME_GUARD_CLOUD_RUN_SERVICES), _load_services() ignores that disabled target but _region_for_service() still returns its region. Because this new call now applies that region to the Cloud Run log filter, the guard can query the disabled target's location and miss failures/successes from the actual deployed region.

Useful? React with 👍 / 👎.

Comment on lines +370 to +372
_status(entry) == 429
and _request_path(entry) == "/monitor-dispatch"
and "NO AVAILABLE INSTANCE" in _entry_text(entry).upper()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle scheduler log shape for monitor-dispatch 429s

When RUNTIME_GUARD_SCHEDULER_JOB_PATTERN is broad enough to include the monitor dispatcher job, Cloud Scheduler target failures are logged as URL_ERROR/URL_UNREACHABLE entries (Google docs: https://docs.cloud.google.com/scheduler/docs/troubleshooting#job-fails-due-to-unreachable-destination-target), so they can lack httpRequest.status/requestUrl; this predicate won't match those 429 monitor-dispatch capacity entries, and _is_failure will still alert on the scheduler failure that the new ignore was supposed to suppress.

Useful? React with 👍 / 👎.

@Pigbibi Pigbibi deleted the codex/runtime-guard-hardening-20260704 branch July 3, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant